import '@rainbow-me/rainbowkit/styles.css';
import {
  getDefaultConfig,
  RainbowKitProvider,
} from '@rainbow-me/rainbowkit';
import { WagmiProvider, http } from 'wagmi';
import {
  bscTestnet
} from 'wagmi/chains';
import {
  QueryClientProvider,
  QueryClient,
} from "@tanstack/react-query";


const config = getDefaultConfig({
  appName: 'My RainbowKit App',
  projectId: 'fdbad4749b724715af1e28c9e33e1214',
  chains: [bscTestnet],
  transports: {
    [bscTestnet.id]: http('https://bsc-prebsc-dataseed.bnbchain.org/') // BSC Testnet RPC
  }
  // ssr: true, // If your dApp uses server side rendering (SSR)
});


const queryClient = new QueryClient();
const RainbowKit = ({ children }: { children: React.ReactNode }) => {
  return (
    <WagmiProvider config={config}>
      <QueryClientProvider client={queryClient}>
        <RainbowKitProvider locale="en-US" initialChain={bscTestnet}>
          {children}
        </RainbowKitProvider>
      </QueryClientProvider>
    </WagmiProvider>
  );
};

export default RainbowKit;